const QiniuUtil = require("../utils/qiniu");
const QiniuConfig = require("../config/qiniu");
const fileUtil = require("../utils/file");

module.exports = {
  uploadFile: function(file) {
    const key = fileUtil.generateFileName(file.name);
    const uptoken = QiniuUtil.generateUptoken(QiniuConfig.BUCKET, key);
    return QiniuUtil.uploadFile(uptoken, key, file.path);
  }
};
